var vueapp = new Vue({ el: '#vueapp', data: { iOrWe: '[I | we]', typeOfApp: '', typeOfAppTxt: '[open source | free | freemium | ad-supported | commercial]', typeOfDev: '', appName: '[App Name]', myOrOur: '[my|our]', meOrUs: '[me|us]', atNoCost: '[at no cost]', retainedInfo: '[retained on your device and is not collected by [me|us] in any way]|[will be retained by us and used as described in this privacy policy].', devName: '', companyName: '', devOrCompanyName: '[Developer name or Company name]', pidInfoIn: '', pidInfo: '[add whatever else you collect here, e.g. users name | address | location | pictures]', gps: true, admob: false, firebase_analytics: false, piwik: false, fabric: false, crashlytics:false }, methods: { selectAllText: function (id) { selectText(id) }, generateHTML: function (id, filename) { let content = getContent(id) let rawHTML = getRawHTML(content) downloadHTML(filename, rawHTML) }, generate: function () { if (this.typeOfDev === 'Individual') { this.devOrCompanyName = this.devName this.iOrWe = 'I' this.myOrOur = 'my' this.meOrUs = 'me' this.retainedInfo = 'retained on your device and is not collected by ' + this.meOrUs + ' in any way' } else if (this.typeOfDev === 'Company') { this.devOrCompanyName = this.companyName this.iOrWe = 'we' this.myOrOur = 'our' this.meOrUs = 'us' this.retainedInfo = 'will be retained by us and used as described in this privacy policy.' } if (this.typeOfApp === 'Commercial') { this.atNoCost = '' } else { this.atNoCost = 'at no cost' } if (this.pidInfoIn === '') { this.pidInfo = '.' } else { this.pidInfo = ', including but not limited to ' + this.pidInfoIn + '.' } switch (this.typeOfApp) { case 'Free': case 'Freemium': case 'Commercial': this.typeOfAppTxt = 'a ' + this.typeOfApp break case 'Open Source': case 'Ad Supported': this.typeOfAppTxt = 'an ' + this.typeOfApp break } document.getElementById('privacy_tab').click() } } }) function getRawHTML (content) { var head = ' Privacy Policy ' var end = '' var html = head + content + end return html } function getContent (id) { var content = document.getElementById(id) return content.innerHTML } function selectText (containerId) { var range if (document.selection) { range = document.body.createTextRange() range.moveToElementText(document.getElementById(containerId)) range.select() } else if (window.getSelection) { range = document.createRange() range.selectNode(document.getElementById(containerId)) window.getSelection().addRange(range) } } function download (filename, text, format) { format += ';charset=utf-8,' var pom = document.createElement('a') pom.setAttribute('href', format + encodeURIComponent(text)) pom.setAttribute('download', filename) if (document.createEvent) { var event = document.createEvent('MouseEvents') event.initEvent('click', true, true) pom.dispatchEvent(event) } else { pom.click() } } function downloadHTML (filename, content) { filename += '.html' download(filename, content, 'data:text/html') }